﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Database;

namespace smallDeimos
{
    public partial class Admin : System.Web.UI.Page
    {
        System.Timers.Timer t;
        protected void Page_Load(object sender, EventArgs e)
        {
          string   User = Session["User"].ToString();
          if (User.Equals("aDmiN") == false)
          {
              Response.Redirect("Default.aspx");
              return;
          }
            t = (System.Timers.Timer)Application["t"];
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                StoredProcedures.CreateLogTable();
            }
            catch (Exception ex)
            {
                throw new Exception("button1_click", ex);
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            StoredProcedures.RestartGame();
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            StoredProcedures.CreateGame(); 
        }

        protected void Button4_Click(object sender, EventArgs e)
        {
            StoredProcedures.RunQuery(TextBox1.Text);
        }

        protected void Button5_Click(object sender, EventArgs e)
        {
            StoredProcedures.CleanDB();
        }

        protected void Button6_Click(object sender, EventArgs e)
        {
            StoredProcedures.SentMessageToAllPlayers(TextBox2.Text);
        }
    }
}
